Our next topic covers
ingress requests when the traffic is not coming
from outside the application. Google Cloud Armor is used
to filter requests that come in through the global
HTTPS load balancer. In other words, it handles requests that come in
from the Internet. However, requests that come
in through the default and custom domain of a Cloud
Run service do not go through Google Cloud Armor
because they are coming from the internal environment within the network your
application is running in. This means you may
need to configure ingress settings to
filter this traffic. One of the ways to
do this is to use the ingress proxy and Cloud Run to disable
the default domain. The ingress proxy can
filter requests by origin. It knows three source types. The sources are resources
from the VPC network, including those in the VPC
Service Control Perimeter, traffic that passes through the global HTTPS load balancer
and all other sources, including google Cloud
services such as Pub/Sub. There are three modes that
are increasingly permissive, starting with internal only. The most restrictive
setting is internal, as it only allows requests
that originate from resources on a Virtual
Private Cloud or VPC. The VPC provides networking between resources and the VPC. Examples include compute engine, virtual machines and containers and Google Kubernetes Engine. We'll discuss the VPC
in more depth later on. If you're calling a Cloud
Run service that is restricted to receive
only internal requests, you can use the regular
external domain name. This mode does not allow
incoming traffic from Google services such as
Pub/Sub or cloud tasks, as those do not run in the VPC. This is why the label internal
can be confusing here. This mode also
prevents requests from other cloud Run services
reaching your service. Unless you use a nerveless
VPC access connector, but more about that later. The second mode allows
internal traffic from the VPC as well as requests that come through
Cloud load balancing. This mode is called internal
and load balancing. The main use case
for this setting is to make your
service available for requests through the
HTTPS load balancer and disable the default URL. This can be useful
if you've added Google Cloud Armor and want
to prevent an attacker from finding out the
default domain of a service and using that to
bypass the security policy. Please note that it's not
possible to allow requests exclusively through the
HTTPS load balancer. You must include the
VPC source as well. The third and final mode of the ingress proxy is to allow
requests from all origins. This is the default setting. I've explained the
three different origins in the three modes. I realized that might
have been a lot to take in a short period of time. Let's do a quick summary. Internal, make your
service private, which allows only
request from resources in the VPC of the same project. Internal and Cloud
load balancing allow requests that come through the global
HTTPS load balancer as well as internal requests. All, allow all
incoming requests, enabling the default
run.app URL. Now it's important
to realize that the most managed
Google Cloud services, including Cloud Run, Pub/Sub, cloud tasks and workflows
are not considered internal because they run
outside of the VPC network.